<template>
    <span :content="content">
        <el-button class="copy-btn" type="primary" size="mini" v-if="content"
                   v-clipboard:copy='content'
                   v-clipboard:success='clipboardSuccess'>
            <i class="iconfont">&#xe60e;</i>
        </el-button>
    </span>
</template>
<script>
    export default {
        name: 'sdCopyButton',
        props: {
            content: {
                required: true,
            }
        },
        data () {
            return {
            }
        },
        model: {
            prop: 'value',
            event: 'change'
        },
        methods: {
            // 复制成功
            clipboardSuccess() {
                this.$message({
                    message: this.$t('components.copyButton.successfulCopy'),
                    type: 'success',
                    duration: 1500
                })
            }
        }
    }
</script>
<style scoped>
    /* el-button 复制按钮 */
    .copy-btn {
        padding: 3px;
    }
    .copy-btn .iconfont {
        margin-right: 0;
    }
</style>
